using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class ICTemplateMap : EntityTypeConfiguration<ICTemplate>
    {
        public ICTemplateMap()
        {
            // Primary Key
            this.HasKey(t => new { t.FID, t.FFieldName });

            // Properties
            this.Property(t => t.FID)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.FCaption)
                .HasMaxLength(50);

            this.Property(t => t.FFieldName)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.FFontName)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.FFilter)
                .HasMaxLength(1000);

            this.Property(t => t.FRelationID)
                .HasMaxLength(400);

            this.Property(t => t.FAction)
                .HasMaxLength(400);

            this.Property(t => t.FVBACtlType)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.FCaption_CHT)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.FCaption_EN)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.FDefaultValue)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.FMaxValue)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.FMinValue)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.FFormat)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("ICTemplate");
            this.Property(t => t.FID).HasColumnName("FID");
            this.Property(t => t.FCtlIndex).HasColumnName("FCtlIndex");
            this.Property(t => t.FTabIndex).HasColumnName("FTabIndex");
            this.Property(t => t.FCaption).HasColumnName("FCaption");
            this.Property(t => t.FCtlType).HasColumnName("FCtlType");
            this.Property(t => t.FLookUpCls).HasColumnName("FLookUpCls");
            this.Property(t => t.FNeedSave).HasColumnName("FNeedSave");
            this.Property(t => t.FValueType).HasColumnName("FValueType");
            this.Property(t => t.FSaveValue).HasColumnName("FSaveValue");
            this.Property(t => t.FFieldName).HasColumnName("FFieldName");
            this.Property(t => t.FLeft).HasColumnName("FLeft");
            this.Property(t => t.FTop).HasColumnName("FTop");
            this.Property(t => t.FWidth).HasColumnName("FWidth");
            this.Property(t => t.FHeight).HasColumnName("FHeight");
            this.Property(t => t.FEnable).HasColumnName("FEnable");
            this.Property(t => t.FPrint).HasColumnName("FPrint");
            this.Property(t => t.FFontName).HasColumnName("FFontName");
            this.Property(t => t.FFontSize).HasColumnName("FFontSize");
            this.Property(t => t.FSelBill).HasColumnName("FSelBill");
            this.Property(t => t.FMustInput).HasColumnName("FMustInput");
            this.Property(t => t.FFilter).HasColumnName("FFilter");
            this.Property(t => t.FRelationID).HasColumnName("FRelationID");
            this.Property(t => t.FAction).HasColumnName("FAction");
            this.Property(t => t.FLockA).HasColumnName("FLockA");
            this.Property(t => t.FROB).HasColumnName("FROB");
            this.Property(t => t.FDefaultCtl).HasColumnName("FDefaultCtl");
            this.Property(t => t.FVisForBillType).HasColumnName("FVisForBillType");
            this.Property(t => t.FVBACtlType).HasColumnName("FVBACtlType");
            this.Property(t => t.FRelateOutTbl).HasColumnName("FRelateOutTbl");
            this.Property(t => t.FSysMustInputItem).HasColumnName("FSysMustInputItem");
            this.Property(t => t.FCaption_CHT).HasColumnName("FCaption_CHT");
            this.Property(t => t.FCaption_EN).HasColumnName("FCaption_EN");
            this.Property(t => t.FInEntryForSPrint).HasColumnName("FInEntryForSPrint");
            this.Property(t => t.FRMustInput).HasColumnName("FRMustInput");
            this.Property(t => t.FIsVisibleForList).HasColumnName("FIsVisibleForList");
            this.Property(t => t.FCanEditedAllTime).HasColumnName("FCanEditedAllTime");
            this.Property(t => t.FAllowCopy).HasColumnName("FAllowCopy");
            this.Property(t => t.FDefaultValue).HasColumnName("FDefaultValue");
            this.Property(t => t.FMaxValue).HasColumnName("FMaxValue");
            this.Property(t => t.FMinValue).HasColumnName("FMinValue");
            this.Property(t => t.FFormat).HasColumnName("FFormat");
        }
    }
}
